<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../img/asset-favico.ico">
    <title>预约</title>
    <link rel="stylesheet" href="../css/page-health-order.css"/>

    <!-- 页面 css js -->
    <script src="../plugins/vue/axios-0.18.0.js"></script>
    <script src="../plugins/healthmobile.js"></script>
    <!--<script src="../js/page-health-order.js"></script>-->

    <script src="../plugins/vue/vue.js"></script>
    <link rel="stylesheet" href="../plugins/element-ui/lib/theme-chalk/index.css"/>
    <script src="../plugins/element-ui/lib/index.js"></script>

    <style>

        .demonstration {
            padding-left: 30px;
        }

        .gr-date-style {

        }

        .gr-button-style el-button {
            border: 1px solid black;
        }

        .gr-button-style {
            padding-top: 30px;
            text-align: center;
        }

        .gr-date-button-style {
            height: 200px;
            width: 100%;
            padding-top: 30px;
        }

    </style>

</head>
<body data-spy="scroll" data-target="#myNavbar" data-offset="150">
<div id="app">
    <div class="app">
        <!-- 页面头部 -->
        <div class="top-header">
            <span class="f-left"><i class="icon-back" onclick="history.go(-1)"></i></span>
            <span class="center">传智健康</span>
            <span class="f-right">
                <el-row class="block-col-2">
                    <el-dropdown trigger="click">
                        <span class="el-dropdown-link">
                            <i class="el-icon-more"></i>
                        </span>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item icon="el-icon-s-home">
                                <el-button type="text" @click="toIndex()">首&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;页</el-button>
                            </el-dropdown-item>
                            <el-dropdown-item icon="el-icon-user">
                                <el-button type="text" @click="toPersonalCenter()">个人中心</el-button>
                            </el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </el-row>
            </span>
        </div>

        <!--查询日期框-->
        <div class="gr-date-button-style">
            <div class="gr-date-style">
                <div class="block">
                    <el-row>
                        <el-col :span="7">
                            <span class="demonstration">请选择日期范围</span>
                        </el-col>
                        <el-col :span="17">
                            <el-date-picker
                                    v-model="dates"
                                    type="daterange"
                                    range-separator="至"
                                    start-placeholder="开始日期"
                                    end-placeholder="结束日期"
                                    value-format="yyyy-MM-dd">
                            </el-date-picker>
                        </el-col>
                    </el-row>
                </div>
            </div>

            <div class="gr-button-style">
                <el-button type="primary" @click="findByDate()" round>查&nbsp;&nbsp;&nbsp;&nbsp;询</el-button>
            </div>
        </div>

        <!-- 页面内容 -->
        <div class="contentBox">
            <div class="list-column1">
                <ul class="list">
                    <li class="list-item" v-for="map in historyRecordList">
                        <!--跳转到预约详情页面-->
                        <a class="link-page" :href="'recordDetails.html?id='+map.o_id">

                            <img class="img-object f-left" :src="'http://qghyk26b4.hd-bkt.clouddn.com/'+map.s_img"
                                 alt="">
                            <div class="item-body">
                                <h4 class="ellipsis item-title">体检人:{{map.m_name}}</h4>
                                <h5 class="ellipsis item-title">预约套餐:{{map.s_name}}</h5>
                                <p>点击查看预约详情</p>
                            </div>
                        </a>
                    </li>
                </ul>
            </div>
        </div>

    </div>
</div>


<script>

    var vue = new Vue({

        el: '#app',

        data: {
            dates: '',
            historyRecordList: []
        },

        methods: {

            getMyCookie(key) {
                var val = "";
                // 对cookie操作
                var cookies = document.cookie;
                cookies = cookies.replace(/\s/, "");
                var cookie_array = cookies.split(";");
                for (i = 0; i < cookie_array.length; i++) {
                    // yh_mch=lilei
                    var cookie = cookie_array[i];
                    var array = cookie.split("=");
                    if (array[0] == key) {
                        val = array[1];
                    }
                }
                return val;
            },

            toIndex() {
                window.location.href="index.html";
            },

            toPersonalCenter() {
                window.location.href="personalCenter.html";
            },

            findByDate() {

                let telephone = this.getMyCookie("telephone");

                let param = {
                    telephone:telephone,
                    startDate:this.dates[0],
                    endDate:this.dates[1]
                };
                axios.post("/order/findHistoryRecord.do", param).then((resp) => {
                    if (resp.data.flag) {
                        this.historyRecordList = resp.data.data;
                    } else {
                        this.$message.error(resp.data.message);
                    }
                });
            }

        },

    });

</script>

</body>